package com.weiadmin.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.weiadmin.common.PageParam;
import com.weiadmin.dao.SlideDao;
import com.weiadmin.model.system.SlideModel;
import com.weiadmin.service.SlideService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

/**
 * 轮播图服务实现类
 * @author: shizhongyu
 * @date: 2023年06月01日 15:39
 */
@Service
public class SlideServiceImpl extends ServiceImpl<SlideDao, SlideModel> implements SlideService {

    @Resource
    SlideDao dao;

    @Override
    public Page<SlideModel> getList(PageParam pageParam) {
        Page<SlideModel> pager = new Page<>(pageParam.getPage(),pageParam.getLimit());
//        LambdaQueryWrapper<Slide> lambdaQueryWrapper = Wrappers.lambdaQuery();
//        lambdaQueryWrapper.orderby();
//        lambdaQueryWrapper.orderByDesc("id");
        QueryWrapper<SlideModel> queryWrapper = new QueryWrapper<>();
        queryWrapper.orderByDesc("id");
        Page<SlideModel> slidePage = dao.selectPage(pager, queryWrapper);
        return slidePage;
    }
}
